<template>
  <div>
    {{ss}}
    <h2>{{ name }}小朋友</h2>
    <table align="center" border="1" cellspacing="0">
      <tr>
        <td>{{ss.name}}</td>
        <td v-for="i in ss.gra">{{i.name}}</td>
      </tr>
    </table>
    <button @click="sheng">点击升班</button>
  </div>
</template>

<script>
export default {
  name: "xpy",
  data() {
    return {
      banji: localStorage.getItem('banji'),
      name: localStorage.getItem('name'),
      userid:localStorage.getItem('userid'),
      ss: {}
    }
  },
  methods:{
    get_ban(){
      this.$axios.get('users/PdlAPI/?id='+this.banji)
      .then(res=>{
        this.ss = res.data.list
      })
    },
    sheng(){
      this.$axios.put('users/PdlAPI/?uid='+this.userid)
      .then(res=>{
        if(res.data.code==200){
          alert('升班完成')
          this.banji = res.data.aaa
          this.get_ban()
        }else {
          alert('no')
        }
      })
    }
  },
  mounted() {
    this.get_ban()
  }
}
</script>

<style scoped>

</style>
